-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add USB audio support #708
base: main
Are you sure you want to change the base?
Conversation
Build for testing: |
@probonopd You are welcome. The RPi 4 or 5 must run in host mode, not gadget mode, and the USB audio interface must be connected, when the system is started (no hot-plugging here). |
Thanks for the clarification @rsta2, of course I meant "must run in host mode, not gadget mode". Corrected above. |
Well, tried the MiniDexed_2024-08-23-9ade4be in a RPi400 and it was able to connect to an Arturia MiniFuse1 but the audio comes out distorted. So I guess, the SoundDevice=usb does work but there's something still needing to be tweaked, most likely on the settings side but all I know I could try would be audio bit depth and audio rate ...and even tried ChunkSize=256 and ChunkSize=512, just in case this refers to the "audio buffer" size, but no change. |
Thanks for testing @Koshdukai. Any chance you could record and upload this for us to listen to? |
I did try to attach a zip with a .wav of the audio but the attachment didn't "stick" ah, it worked this time :) |
I will try this MiniDexed test version by myself here soon. |
btw, I initially tried it with an old Propellerhead Balance interface that I'm already using with no issues with that same RPi400 running Zynthian, but this MiniDexed build didn't look like it was able to use it. |
Unfortunately I wasn't successful testing with my Alesis Core1 interface. I set |
I have to confirm, that this test version produces noise via USB audio streaming, but not a clear sound. I tested with an ASUS XONAR U5 interface with 48000 Sa/s and 16-bits sample size. Because after a lot of changes to MiniDexed in the meantime I cannot quickly say, what the reason is or may be. I can only say, that USB audio works with my MiniSynth Pi, but MiniSynth Pi uses the (older) alternate programming interface, provided by the class Taking into account that USB audio devices do not work with a fixed chunk size, this may affect the behavior of the class Now I have to port MiniSynth Pi to the standard interface of |
I got MiniDexed working with the initial USB build with these USB audio streaming devices:
The ChunkSize parameter is very critical. I used these parameters in minidexed.ini:
A chunk size of 256 did not work, neither did 1024. I think, it should be a multiple of It's important to add the following parameter to the file cmdline.txt on the SD card, if your USB audio streaming device does support a sample size of 24 bits only:
The default is There are many different USB audio streaming devices out there and it's likely, that some of them will not work. To be able to debug the reason, if it does not work, the log messages starting with |
Thank you very much for looking into this @rsta2. |
Build for testing: |
ah so it was ChunkSize related, as I was kinda suspecting/hoping :) In 44.1KHz case, I'm guessing 441 should work but I'm wondering how to deal with any of the non-integer multiples below it. Anyway, time to test this latest build :) |
Got it working on the Arturia MiniFuse1 with both soundopt=16 or soundopt=24 (it supports both formats, so that checks out). I'm now going to check if minimum changes to the ChunkSize affect that cycle, hopefully finding a value that makes it disapear... if still ChunkSize related. btw, Propellerhead Balance still doesn't work (but that's ok) giving a "Cannot initialize function" usbdev error. |
@Koshdukai Thanks for testing! Please try |
I think I tried both, without and with 16 or 24 on Balance but I'll recheck ASAP :) |
This is a pretty exciting development. Apologies if Im getting to far ahead, but would it be possible to set up USB audio so it defaults to I2s (or other "internal" audio hardware) if no USB audio source was detected and switches to USB audio out when a device was connected? |
@miotislucifugis Yes, it's possible to detect, if an USB audio streaming
device with the configured sample size (16 or 24 bits) is connected, but you
have to know, which sample size the device has, which you want to use. Perhaps
it's preferable to use 24 bits sample size by default (option soundopt=24 in
cmdline.txt), because normally only cheap devices do not support this.
But let us see first, if more devices show this click issue. Currently there
are three known devices, which work and one, which shows clicks. Another two
devices are not detected, but this may be a configuration problem (soundopt=).
|
Just re-checked and confirmed that it doesn't make a difference. Balance still gives the "Cannot initialize function" usbdev error. oh! speaking of weird USB audio... let me check the TE OP-1 :D Edit: nope. Should be soundopt=16 (but also tried 24) & SampleRate=44100 but isn't detected either. |
@Koshdukai Thanks for testing! :D |
@paolofalcoruegg When you attach a HDMI display, you will get the MiniDexed log. I'm interested in the lines, which are starting with "uaudio" or "sndusb" (after the time). |
Here is a list of the USB audio streaming devices, which have been successfully tested with Circle. Other devices may or may not work. Unfortunately there is no quick way to support many more devices. Each problem would have to be sorted out separately with user support, which can take longer. We did this before for some devices. My assumption was, that Circle would already work with more devices, but maybe this was wrong. Finally I have to say, that Circle is a bare metal environment, which has been developed by very few developers. You cannot compare it with Linux in this field. Someone who creates a new USB audio interface, will probably test it with Linux on its own, but not with Circle. And I cannot buy all these interfaces to test them. |
Build for testing: |
Build for testing: |
This will become really interesting if it can work for more RPi models as discussed here: |
Thanks @rsta2
To test this, you need a Raspberry Pi larger than 3, not be running in USB gadget mode, and need to set
SoundDevice=usb
inminidexed.ini
.#148 (comment)
If you are testing this, please let us know which hardware you are using and what the outcome was. Thanks!